<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var findFinalValue = function (nums, original) {
      while (nums.includes(original)) {
        original *= 2;
      }
      return original;
    };
    console.log(findFinalValue(nums = [5, 3, 6, 1, 12], original = 3))
  </script>
</body>

</html>